package list;

import java.util.*;

/**
 * @Classname TestList
 * @Description TODO
 * @Date 2021/5/12 21:32
 * @Created by 张斌
 */
public class TestList {
    public static void main(String[] args) {
//        LinkedList<Integer> list = new LinkedList<> ();
//        //list.add(10);
//        System.out.println(list);
//        System.out.println(list.poll());
//        System.out.println(list.remove());
        //testArrayList();
        //testHashSet();
        //testTreeSet();
        //testHashMap();
        testLinkList();

    }
    public static void testArrayList(){
        ArrayList<Integer> arrayList=new ArrayList();
        arrayList.add(10);
        arrayList.add(7);
        arrayList.add(100);
        arrayList.add(9);
        Collections.sort(arrayList);
        System.out.println(arrayList);

    }
    public static void testHashSet() {
        HashSet<Integer> hashSet=new HashSet<>();
        hashSet.add(10);
        hashSet.add(11);
        hashSet.add(12);
        System.out.println(hashSet.add(10));
        System.out.println(hashSet);
    }
    public static void testTreeSet() {
        TreeSet<Integer> treeSet=new TreeSet<>();
        treeSet.add(13);
        treeSet.add(10);
        treeSet.add(11);
        treeSet.add(12);
        System.out.println(treeSet.add(10));
        System.out.println(treeSet);
    }
    public static void testHashMap() {
        HashMap<Integer,String>  hashMap=new HashMap<>();
        hashMap.put(20,"张三");
        hashMap.put(21,"张三");
        hashMap.put(22,"张三");
        hashMap.put(23,"张三");

    }

    public static void testLinkList() {
        LinkedList<String> list = new LinkedList<> ();
        list.add("zhangdan");
        list.add("思思");
        list.add("王五");
        list.addFirst("asdf");
        System.out.println(list.getLast());
        System.out.println(list.getFirst());
        System.out.println(list.element());
        System.out.println(list.remove());
        System.out.println(list.remove());
        System.out.println(list.remove());
        System.out.println(list.remove());

    }

    public static void testArrayList(String[] args) {
        ArrayList<String> list1 = new ArrayList();
        list1.add("lisi");

    }
}
